package com.sbr.seb.wicket;

import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.Request;
import org.apache.wicket.Response;
import org.apache.wicket.Session;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;

import com.sbr.seb.wicket.element.MenuItem;
import com.sbr.seb.wicket.page.HomePage;
import com.sbr.seb.wicket.page.Planning;
import com.sbr.seb.wicket.page.StatsLivraisons;
import com.sbr.seb.wicket.page.administration.AdministrationBasePage;
import com.sbr.seb.wicket.page.delivery.ListDeliveriesPage;
import com.sbr.seb.wicket.page.tdb.DefaultTableauDeBordPage;

public class SebApplication extends WebApplication {    


	private List<MenuItem> menuItemList;



	/**
	 * Constructor
	 */
	public SebApplication()	{
		menuItemList = new ArrayList<MenuItem>();

		menuItemList.add(new MenuItem("Accueil", HomePage.class));
		menuItemList.add(new MenuItem("Suivi", ListDeliveriesPage.class));
		menuItemList.add(new MenuItem("Tableau de Bord", DefaultTableauDeBordPage.class));
		//		menuItemList.add(new MenuItem("Add Service Page", AddServicePage.class));
		//		menuItemList.add(new MenuItem("Specification Page", SpecificationPage.class));
		//		menuItemList.add(new MenuItem("Log Page", LogPage.class));
		//		menuItemList.add(new MenuItem("CheckList Manager Page", CheckListManagerPage.class));
		//		menuItemList.add(new MenuItem("Server Manager Page", ServerManagerPage.class));
		//		menuItemList.add(new MenuItem("Suivi Alter Page", SuiviAlters.class));
		menuItemList.add(new MenuItem("Recherche", HomePage.class));
		menuItemList.add(new MenuItem("Planning", Planning.class));
		//		menuItemList.add(new MenuItem("Add Project Page", AddProject.class));
		//		menuItemList.add(new MenuItem("Suivi Livraison Page", SuiviLivraisons.class));
		//		menuItemList.add(new MenuItem("Suivi Installation Recette Page", SuiviInstallationRecette.class));
		menuItemList.add(new MenuItem("Statistiques", StatsLivraisons.class));
		//		menuItemList.add(new MenuItem("Administration", SuiviInstallationRecette.class));
		menuItemList.add(new MenuItem("Administration", AdministrationBasePage.class));

	}



	/**
	 * @see org.apache.wicket.Application#getHomePage()
	 */
	@Override
	public Class<HomePage> getHomePage() {
		return HomePage.class;
	}

	@Override
	protected void init() {
		super.init();
		//		IResourceSettings resourceSettings = getResourceSettings();
		//		resourceSettings.addResourceFolder("pages");
		//		resourceSettings.setResourceStreamLocator(new PathStripperLocator());
		addComponentInstantiationListener(new SpringComponentInjector(this));
	}

	public List<MenuItem> getMenuItemList() {
		return menuItemList;
	}

	public void addMenuItem(MenuItem menuItem) {
		menuItemList.add(menuItem);
	}

	@Override
	public Session newSession(Request request, Response response){
		return new SebSession(request);
	}

}
